#pragma once

#include<stdint.h>
typedef struct
{
	char* content;
	uint32_t count, cap, type_size;
}Lily_List;
typedef Lily_List Li_List_t;
typedef Lily_List* Li_List;
typedef Li_List Li_Stack;
typedef Li_List_t Li_Stack_t;

typedef struct {
	char* str;
	int32_t length;
}Li_String_def;
typedef Li_String_def* Li_String;


#define list_index(list,i) ((list)->content+(i)*list->type_size)
//e.g.: Li_list list = new_li(int32_t);
#define new_li(type) new_list(sizeof(type),4)
//e.g.: Li_list list = new_li_cap(int32_t,8);
#define new_li_cap(type,cap) new_list(sizeof(type),cap)
//e.g.: int32_t index = li_add(list,item);
#define li_add(list,obj) (list_add(list,&(obj)))
//e.g.: string* strs = list_content(list, string);
#define list_content(list,type) ((type*)((list)->content))

int32_t init_list(Lily_List* list, uint32_t unit_size2, uint32_t init_cap);

Lily_List* new_list(uint32_t type, uint32_t init_cap);
Lily_List* copy_list(Li_List src);
int32_t list_recap(Lily_List* list, uint32_t new_cap);
int32_t list_add(Lily_List* list, void* c);
int32_t list_remove_at(Lily_List* list, uint32_t index);
char list_item_equal(void* item1, void* item2, uint32_t type);
int32_t list_remove(Lily_List* list, void* item);
int32_t list_find(Lily_List* list, void* item);
int32_t delete_list(Lily_List* list);
int32_t delete_list_t(Lily_List* list);
int32_t delete_list_recursively(Lily_List* list);

int32_t list_reduction(Li_List list);

int32_t list_insert(Li_List list, void* c, int32_t at);

// int32_t stack_push(Li_Stack list, void* c);

// int32_t stack_pop(Li_Stack list, void* dst_ptr);

// int32_t stack_peek(Li_Stack list, void* dst_ptr);
